#ifndef PICANIMATIONWID_H
#define PICANIMATIONWID_H
#include <QWidget>
#include <QTreeWidgetItem>
class PicAnimationWid : public QWidget
{
    Q_OBJECT
public:
    explicit PicAnimationWid(QWidget *parent = nullptr);
    ~PicAnimationWid();
    void SetPixmap(QTreeWidgetItem* item);
    void Start();
    void stop();

    void SlideNext();//切换到下一张图片进行放映
    void SlidePre();//切换到上一张图片进行放映

    void SlotUpSelectShow(QString path);//实现点击缩略图然后显示区域也会发生变化
    void SlotStartOrStop();//实现控制播放的逻辑
protected:
    virtual void paintEvent(QPaintEvent *event);
private:
    float _factor;
    QTimer* _timer;
    QPixmap _pixmap1;
    QPixmap _pixmap2;
    QTreeWidgetItem* _cur_item;
    QMap<QString,QTreeWidgetItem*>_map_items;
    bool _bstart;

    void UpSelectPixmap(QTreeWidgetItem* item);
private slots:
    void TimeOut();
signals:
    void SigPreList(QTreeWidgetItem*);
    void SigSelectItem(QTreeWidgetItem*);

    void SigStart();//当开启轮播图演示的时候通知界面将按钮按照正确方式展示
    void SigStop();

    //由动画界面来决定是否开启/关闭音乐
    void SigStartMusic();
    void SigStopMusic();
};

#endif // PICANIMATIONWID_H
